package com.sino.business.service;

import com.sino.bean.Zlbhzk;
import com.sino.business.IZlbhzkService;
import com.sino.dao.IBasicInfoDAO;
import com.sino.model.ZlbhzkModel;

public class ZlbhzkServiceImp implements IZlbhzkService{
	
	private IBasicInfoDAO basicInfoDAO = null;
	/**
     * Description       	   ：保存专利保护状况信息到数据库中
     * @param zlbhzkModel 	   ：专利保护状况基础类
     */
	public void saveZlbhzk(ZlbhzkModel zlbhzkModel){
		Zlbhzk zlbhzk = new Zlbhzk();
		zlbhzk.setZlbhinfo(zlbhzkModel.getZlbhinfo());
		zlbhzk.setZlid(zlbhzkModel.getZlid());
		
		if(this.getBasicInfoDAO().findZlbhzkByIdClear(zlbhzkModel.getZlid()) != null){
			this.getBasicInfoDAO().updateZlbhzk(zlbhzk);
		}else{
			this.getBasicInfoDAO().saveZlbhzk(zlbhzk);
		}
		
	}
	/**
     * Description       	   ：更新专利保护状况信息到数据库中
     * @param zlbhzkModel 	   ：专利保护状况基础类
     */
	public void updateZlbhzk(ZlbhzkModel zlbhzkModel){}
	
	/**
     * Description       	   ：根据专利id查找专利保护状况
     * @param zlId 	   	  	   ：专利id
     */
	public ZlbhzkModel findZlbhzkById(String zlId){
		ZlbhzkModel zlbhzkModel = new ZlbhzkModel();
		Zlbhzk zlbhzk = this.getBasicInfoDAO().findZlbhzkById(zlId);
		if(zlbhzk == null){
			return zlbhzkModel;
		}
		zlbhzkModel.setZlbhinfo(zlbhzk.getZlbhinfo());
		zlbhzkModel.setZlid(zlbhzk.getZlid());
		return zlbhzkModel;
	}

	
	//	-----------------------------------------接口
	public IBasicInfoDAO getBasicInfoDAO() {
		return basicInfoDAO;
	}
	public void setBasicInfoDAO(IBasicInfoDAO basicInfoDAO) {
		this.basicInfoDAO = basicInfoDAO;
	}
	
}
